<?php
	require "config.php"; // NOTE:It's a best practice to keep your private information in different file which has access to limited people

	$con = mysql_connect("localhost",$db_user ,$db_pass);
	error_reporting(0);	
	// if an error was encountered, the script exits with an error message
	if (!$con){
		die('Could not connect: ' . mysql_error());
	
    }
	mysql_select_db($db_name, $con); //connecting with the database
	$sql_fetch = "SELECT * FROM Faculty WHERE firstName = '$_POST[firstName]' and lastName = '$_POST[lastName]'"; 	
	$result = mysql_query($sql_fetch); 
?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
	<title>Search Student Data</title>
</head>
<style>
  html {
        overflow: scroll; 
      }
.scrollable{
   overflow: auto;
   width: 70px; /* adjust this width depending to amount of text to display */
   height: 80px; /* adjust height depending on number of options to display */
   border: 1px silver solid;
 }
body{background-image:url('Images/sjsu logo.jpg');
background-repeat: no-repeat;
  background position: top center;
  background-size: 100%;
  background-size: 1400px 1200px;
  position:relative;}
  
h3.pos_fixed{
color:#6D63A9;
position:relative;
top:25px;
left:30px;
}
#b{
position:relative;
top:140px;
left:320px;
}

a:link    {
  /* Applies to all unvisited links */
  text-decoration:  none;
  font-weight:      bold;
  color:          "#blue";
  font-size:120%;
  } 

</style>

<div id="b">
   <table border='1'>
   <tr> 
    <td><b>SSN</b></td>
    <td><b>StudentID</b></td>
    <td><b>First Name</b></td>
    <td><b>Last Name</b></td>
    <td><b>Designation</b></td>
    <td><b>Salary</b></td>
   </tr>
<div id = "e">
<? 
$num_rows = mysql_num_rows($result);
   if ($num_rows == 0) {
	   echo "Faculty record not found in the system <br> <br> <br>";
   }

	while($row = mysql_fetch_array($result)){
	echo "<tr>";
	echo "<td>" . $row['SSN'] . "</td>";
	echo "<td>" . $row['facultyId'] . "</td>";
	echo "<td>" . $row['firstName'] . "</td>";
	echo "<td>" . $row['lastName'] . "</td>";
	echo "<td>" . $row['designation'] . "</td>";
	echo "<td>" . $row['salary'] . "</td>";
	echo "</tr>";
   	}
   mysql_close($con);?>
  </table>
<div id="c">
<div id="d"><br><br><a href="MainMenu.php">Home</a>
</body>
</html>
